<!DOCTYPE html>
<html>
<head>
    
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-104674648-1', 'auto');
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- End Google Analytics -->


    

    
<!-- Baidu Tongji -->
<script>var _hmt = _hmt || []</script>
<script async src="//hm.baidu.com/hm.js?d230cbd4c1f4abd065bc1ca0e61663da"></script>
<!-- End Baidu Tongji -->




    <meta charset="utf-8">
    
    <meta name="google-site-verification" content="x0NhT11Wdmfn9lsdbcQQOIhQHQKeNWATVfTj5rYZWXo">
    
    
    
    
    <title>使用Cubemx移植FatFs到stm32 | Zhuhao&#39;s Blog | I am the captain of my ship and the master of my fate.</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="stm32">
    <meta name="description" content="使用Cubemx移植FatFs到stm32 在大型的存储器中，没有文件系统是万万不可行的，你不可能每次要打开一个文件都要从头到尾扫描一遍存储器，几兆的小存储器还好，几G甚至几T的存储器就根本没办法这么做了。而且有了文件系统也可以方便的管理使用各类文件。 这一次使用Cubemx生成FatFs的初始化代码，然后做最后的移植工作。本人使用的是stm32f767的野火的板子。 介绍一下FafFs 系统架构">
<meta name="keywords" content="stm32">
<meta property="og:type" content="article">
<meta property="og:title" content="使用Cubemx移植FatFs到stm32">
<meta property="og:url" content="http://greedyhao.cc/2018/07/05/工作-stm32-2018-07-05-使用Cubemx移植FatFs到stm32/index.html">
<meta property="og:site_name" content="Zhuhao&#39;s Blog">
<meta property="og:description" content="使用Cubemx移植FatFs到stm32 在大型的存储器中，没有文件系统是万万不可行的，你不可能每次要打开一个文件都要从头到尾扫描一遍存储器，几兆的小存储器还好，几G甚至几T的存储器就根本没办法这么做了。而且有了文件系统也可以方便的管理使用各类文件。 这一次使用Cubemx生成FatFs的初始化代码，然后做最后的移植工作。本人使用的是stm32f767的野火的板子。 介绍一下FafFs 系统架构">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="http://elm-chan.org/fsw/ff/res/modules.png">
<meta property="og:image" content="http://elm-chan.org/fsw/ff/res/layers.png">
<meta property="og:image" content="http://greedyhao.cc/img/stm32/required_functions.png">
<meta property="og:image" content="http://greedyhao.cc/img/stm32/cubemx_fatfs_flash_1.png">
<meta property="og:image" content="http://greedyhao.cc/img/stm32/cubemx_fatfs_flash_2.png">
<meta property="og:image" content="http://greedyhao.cc/img/stm32/cubemx_fatfs_flash_3.png">
<meta property="og:image" content="http://greedyhao.cc/img/stm32/cubemx_fatfs_flash_4.png">
<meta property="og:image" content="http://greedyhao.cc/img/stm32/cubemx_fatfs_flash_5.png">
<meta property="og:updated_time" content="2018-09-09T04:02:39.558Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="使用Cubemx移植FatFs到stm32">
<meta name="twitter:description" content="使用Cubemx移植FatFs到stm32 在大型的存储器中，没有文件系统是万万不可行的，你不可能每次要打开一个文件都要从头到尾扫描一遍存储器，几兆的小存储器还好，几G甚至几T的存储器就根本没办法这么做了。而且有了文件系统也可以方便的管理使用各类文件。 这一次使用Cubemx生成FatFs的初始化代码，然后做最后的移植工作。本人使用的是stm32f767的野火的板子。 介绍一下FafFs 系统架构">
<meta name="twitter:image" content="http://elm-chan.org/fsw/ff/res/modules.png">
    
        <link rel="alternate" type="application/atom+xml" title="Zhuhao&#39;s Blog" href="/atom.xml">
    
    <link rel="shortcut icon" href="/favicon.png">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@latest/css/style.css">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide" >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/brand.jpg)">
      <div class="brand">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="/img/portrait.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">Greedyhao</h5>
          <a href="mailto:hao_kr@163.com" title="hao_kr@163.com" class="mail">hao_kr@163.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                Archives
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                Tags
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/categories"  >
                <i class="icon icon-lg icon-th-list"></i>
                Categories
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/greedyhao" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">使用Cubemx移植FatFs到stm32</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">使用Cubemx移植FatFs到stm32</h1>
        <h5 class="subtitle">
            
                <time datetime="2018-07-05T07:29:27.000Z" itemprop="datePublished" class="page-time">
  2018-07-05
</time>


	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/工作/">工作</a></li></ul>

            
        </h5>
    </div>

    


</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap post-toc-shrink" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#使用cubemx移植fatfs到stm32"><span class="post-toc-number">1.</span> <span class="post-toc-text">使用Cubemx移植FatFs到stm32</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#介绍一下faffs"><span class="post-toc-number">2.</span> <span class="post-toc-text">介绍一下FafFs</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#系统架构"><span class="post-toc-number">2.1.</span> <span class="post-toc-text">系统架构</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#移植需要注意的地方"><span class="post-toc-number">2.2.</span> <span class="post-toc-text">移植需要注意的地方</span></a></li></ol></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#开始移植"><span class="post-toc-number">3.</span> <span class="post-toc-text">开始移植</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#配置cubemx"><span class="post-toc-number">3.1.</span> <span class="post-toc-text">配置Cubemx</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#补完底层io函数"><span class="post-toc-number">3.2.</span> <span class="post-toc-text">补完底层I/O函数</span></a></li></ol></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#遇到问题和解决问题"><span class="post-toc-number">4.</span> <span class="post-toc-text">遇到问题和解决问题</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#f_mount返回fr_disk_err"><span class="post-toc-number">4.1.</span> <span class="post-toc-text">f_mount返回FR_DISK_ERR</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#f_open返回fr_invalid_name"><span class="post-toc-number">4.2.</span> <span class="post-toc-text">f_open返回FR_INVALID_NAME</span></a></li></ol></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#可以改进的地方"><span class="post-toc-number">5.</span> <span class="post-toc-text">可以改进的地方</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#本工程已上传github"><span class="post-toc-number">6.</span> <span class="post-toc-text">本工程已上传github</span></a></li></ol>
        </nav>
    </aside>


<article id="post-工作-stm32-2018-07-05-使用Cubemx移植FatFs到stm32"
  class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">使用Cubemx移植FatFs到stm32</h1>
        <div class="post-meta">
            <time class="post-time" title="2018-07-05 15:29:27" datetime="2018-07-05T07:29:27.000Z"  itemprop="datePublished">2018-07-05</time>

            
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/工作/">工作</a></li></ul>



            
<span id="busuanzi_container_page_pv" title="文章总阅读量" style='display:none'>
    <i class="icon icon-eye icon-pr"></i><span id="busuanzi_value_page_pv"></span>
</span>


        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <h1 id="使用cubemx移植fatfs到stm32">使用Cubemx移植FatFs到stm32</h1>
<p>在大型的存储器中，没有文件系统是万万不可行的，你不可能每次要打开一个文件都要从头到尾扫描一遍存储器，几兆的小存储器还好，几G甚至几T的存储器就根本没办法这么做了。而且有了文件系统也可以方便的管理使用各类文件。</p>
<p>这一次使用Cubemx生成FatFs的初始化代码，然后做最后的移植工作。本人使用的是stm32f767的野火的板子。</p>
<h1 id="介绍一下faffs">介绍一下FafFs</h1>
<h2 id="系统架构">系统架构</h2>
<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="http://elm-chan.org/fsw/ff/res/modules.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure>
<p>FatFs是一种中间层，可以屏蔽硬件的差异，移植起来非常方便</p>
<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="http://elm-chan.org/fsw/ff/res/layers.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure>
<h2 id="移植需要注意的地方">移植需要注意的地方</h2>
<p>你需要提供FatFs需要的底层I/O函数，需要的函数如下表，但是并不是全部函数都需要，你只需要提供必需的disk_status disk_initialize disk_read 和你需要的就可以。</p>
<div class="figure">
<img src="/img/stm32/required_functions.png">

</div>
<h1 id="开始移植">开始移植</h1>
<h2 id="配置cubemx">配置Cubemx</h2>
<p>因为我准备的是W25Q128上的FatFs，CubeMX上面没有，所以要选择user-defined</p>
<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/img/stm32/cubemx_fatfs_flash_1.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure>
<p>接下来是在Configuration里面配置FatFs，因为需要读取的文件是中文的，所以要配置为中文，然后为以后可能还有别的存储器预留空位，所以配置VOLUMES为3</p>
<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/img/stm32/cubemx_fatfs_flash_2.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure>
<p>还有就是在project setting里面把stack设置的大点</p>
<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/img/stm32/cubemx_fatfs_flash_3.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure>
<p>此外就是W25Q128的基本配置，这些就不提供了，网上有，可以参考<a href="http://www.waveshare.net/study/article-658-1.html" target="_blank" rel="noopener">微雪课堂</a>里的配置。</p>
<p>接下来就是生成代码了</p>
<h2 id="补完底层io函数">补完底层I/O函数</h2>
<p>打开user_disko.c这个文件，可以看到CubeMX自动生成的函数原型。由于我需要读写磁盘，所以我需要补全这些所有的函数USER_initialize USER_status USER_read USER_write USER_ioctl</p>
<h1 id="遇到问题和解决问题">遇到问题和解决问题</h1>
<h2 id="f_mount返回fr_disk_err">f_mount返回FR_DISK_ERR</h2>
<p>这个问题困扰了我好几个小时，我从f_mount-&gt;get_ldnumber用printf找了差不多1个小时的BUG，发现找不到问题，突然间发现我f_mount还调用了一个函数find_volume，而且就算这里出现了问题，就换方向一路追踪find_volume-&gt;check_fs-&gt;move_window-&gt;disk_read，发现是disk_read返回的错误，看到这我就傻眼了，觉得不可能啊，因为我之前读取写入flash都是没有问题的。</p>
<p>第二天脑袋比较清醒了，首先先测试初始化是否成功，在读取成功flash id后确定了初始化成功。</p>
<p>然后再来看看disk_read，它使用的是我提供的一个全局的disk io驱动来读取disk，结构体类型如下</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">typedef struct</span><br><span class="line">&#123;</span><br><span class="line">  uint8_t                 is_initialized[_VOLUMES];</span><br><span class="line">  const Diskio_drvTypeDef *drv[_VOLUMES];</span><br><span class="line">  uint8_t                 lun[_VOLUMES];</span><br><span class="line">  volatile uint8_t        nbr;</span><br><span class="line">&#125;Disk_drvTypeDef;</span><br></pre></td></tr></table></figure>
<p>所以我回到了user_diskio.c查看我的USER_read函数</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">DRESULT USER_read (</span><br><span class="line">	BYTE pdrv,      /* Physical drive nmuber to identify the drive */</span><br><span class="line">	BYTE *buff,     /* Data buffer to store read data */</span><br><span class="line">	DWORD sector,   /* Sector address in LBA */</span><br><span class="line">	UINT count      /* Number of sectors to read */</span><br><span class="line">)</span><br><span class="line">&#123;</span><br><span class="line">  /* USER CODE BEGIN READ */</span><br><span class="line">  FLASH_DEBUG_FUNC();</span><br><span class="line">  DRESULT res = RES_ERROR;</span><br><span class="line">  </span><br><span class="line">    if ((Stat &amp; STA_NOINIT)) </span><br><span class="line">    &#123;</span><br><span class="line">        res = RES_NOTRDY;</span><br><span class="line">    &#125;</span><br><span class="line">  else</span><br><span class="line">  &#123;</span><br><span class="line">    sector+=1536;//扇区偏移，外部Flash文件系统空间放在外部Flash后面6M空间</span><br><span class="line">    res = BSP_QSPI_Read(buff, sector &lt;&lt;12, count&lt;&lt;12);</span><br><span class="line">  &#125;</span><br><span class="line">  </span><br><span class="line">	return res;  </span><br><span class="line">  /* USER CODE END READ */</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>我在USER_read的else括号中加了一个printf，结果发现调用f_mount时，居然没有进入这个else语句，然后我开始怀疑这个<strong>Stat</strong>有问题，所以我把if的条件去掉了，直接执行_sector+=1536;res = BSP_QSPI_Read(buff, sector &lt;&lt;12, count&lt;&lt;12);_这条语句，发现FatFs挂载成功。</p>
<p>很激动，原来问题在于Stat的状态没有更新，因为Stat一开始定义的时候是定义为<strong>STA_NOINIT</strong>。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">/* Disk status */</span><br><span class="line"></span><br><span class="line">static volatile DSTATUS Stat = STA_NOINIT;</span><br></pre></td></tr></table></figure>
<p>接下来就是查找disk的状态没有更新的原因。回到一开始找到返回错误信息的函数find_volume，它的执行过程相当于get_ldnumber-&gt;disk_initialize-&gt;check_fs…一开始就是到了check_fs这一步的时候报错，停止程序的，我们可以发现，这个过程并没有调用到用户定义的USER_status或FatFs定义的disk_status来检查disk的状态更新。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">所以我在初始化中加入了检查disk的状态的代码</span><br><span class="line"></span><br><span class="line">DSTATUS USER_initialize (</span><br><span class="line">	BYTE pdrv           /* Physical drive nmuber to identify the drive */</span><br><span class="line">)</span><br><span class="line">&#123;</span><br><span class="line">  /* USER CODE BEGIN INIT */</span><br><span class="line">  Stat = USER_status(pdrv);</span><br><span class="line">  return BSP_QSPI_Init(); /* Flash的初始化 */</span><br><span class="line">  /* USER CODE END INIT */</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>效果很好，disk的状态更新成功，f_mount挂载正常。</p>
<h2 id="f_open返回fr_invalid_name">f_open返回FR_INVALID_NAME</h2>
<p>好不容易挂载成功了，但是读写还是失败，第一反应是可能在编码上出错了，因为我的工程没有包括cc936.c这个文件，而野火官方的工程却包括了，我怀疑是不是这一点导致无法读取中文，从而FR_INVALID_NAME。</p>
<p>但是我现在还不知道FatFs是怎么调用cc936.c这个文件的，只能先从f_open跟踪进去看看。</p>
<p>f_open-&gt;follow_path，打LOG发现是follow_path中的create_name返回的FR_INVALID_NAME</p>
<p>进入create_name找到返回FR_INVALID_NAME的语句 <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">...</span><br><span class="line">mem_set(sfn, &apos; &apos;, 11);</span><br><span class="line">...</span><br><span class="line">for (;;;) &#123;</span><br><span class="line">    ...</span><br><span class="line">    if (c == &apos;.&apos; || i &gt;= ni) &#123;		/* End of body or over size? */</span><br><span class="line">			if (ni == 11 || c != &apos;.&apos;) return FR_INVALID_NAME;	/* Over size or invalid dot */</span><br><span class="line">			i = 8; ni = 11;				/* Goto extension */</span><br><span class="line">			continue;</span><br><span class="line">	&#125;</span><br><span class="line">    ...</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>由于对于文件名一开始只分配了11个空间，但是我的文件名却超过了11个空间，所以导致了这个问题，在我将我的文件名减少后，问题解决。</p>
<p>文件名长度才11有点短，但是可以通过修改支持长文件名来支持。</p>
<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/img/stm32/cubemx_fatfs_flash_4.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure>
<p>在支持长文件名后，读写长文件名没有问题了</p>
<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/img/stm32/cubemx_fatfs_flash_5.png" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure>
<h1 id="可以改进的地方">可以改进的地方</h1>
<p>本工程没有加入RTC的支持，所以没有去实现get_fattime，因此不支持多磁盘，想支持多磁盘需要实现get_fattime</p>
<h1 id="本工程已上传github">本工程已上传github</h1>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https://github.com/greedyhao/stm32</span><br></pre></td></tr></table></figure>

        </div>

        <blockquote class="post-copyright">
    
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2018-09-09T04:02:39.558Z" itemprop="dateUpdated">2018-09-09 12:02:39</time>
</span><br>


        
        下方的留言框比较调皮，有时候故意不出来，而且还是滚刀肉，实在拿他没办法，所以如果等得不爽可以直接去<a href="https://github.com/greedyhao/greedyhao.github.io/issues" target="_blank" rel="external">issues</a>给我留言
        
    </div>
    
    <footer>
        <a href="http://greedyhao.cc">
            <img src="/img/portrait.jpg" alt="Greedyhao">
            Greedyhao
        </a>
    </footer>
</blockquote>

        
<div class="page-reward">
    <a id="rewardBtn" href="javascript:;" class="page-reward-btn waves-effect waves-circle waves-light">赏</a>
</div>



        <div class="post-footer">
            
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/stm32/">stm32</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://greedyhao.cc/2018/07/05/工作-stm32-2018-07-05-使用Cubemx移植FatFs到stm32/&title=《使用Cubemx移植FatFs到stm32》 — Zhuhao's Blog&pic=http://greedyhao.cc/img/portrait.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://greedyhao.cc/2018/07/05/工作-stm32-2018-07-05-使用Cubemx移植FatFs到stm32/&title=《使用Cubemx移植FatFs到stm32》 — Zhuhao's Blog&source=linux,c,python,stm32" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://greedyhao.cc/2018/07/05/工作-stm32-2018-07-05-使用Cubemx移植FatFs到stm32/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《使用Cubemx移植FatFs到stm32》 — Zhuhao's Blog&url=http://greedyhao.cc/2018/07/05/工作-stm32-2018-07-05-使用Cubemx移植FatFs到stm32/&via=http://greedyhao.cc" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://greedyhao.cc/2018/07/05/工作-stm32-2018-07-05-使用Cubemx移植FatFs到stm32/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between">
  
    <div class="waves-block waves-effect prev">
      <a href="/2018/07/06/工作-stm32-2018-07-06-CubeMX小指南之添加其他软件组件/" id="post-prev" class="post-nav-link">
        <div class="tips"><i class="icon icon-angle-left icon-lg icon-pr"></i> Prev</div>
        <h4 class="title">CubeMX小指南之添加其他软件组件</h4>
      </a>
    </div>
  

  
    <div class="waves-block waves-effect next">
      <a href="/2018/05/25/生活-感悟-2018-05-25-自适应滤波教我做人/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">自适应滤波教我做人</h4>
      </a>
    </div>
  
</nav>



    


<section class="comments" id="comments">
    <div id="disqus_thread"></div>
    <script>
    var disqus_shortname = 'greedyhao';
    lazyScripts.push('//' + disqus_shortname + '.disqus.com/embed.js')
    </script>
    <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</section>
















</article>

<div id="reward" class="page-modal reward-lay">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <h3 class="reward-title">
        <i class="icon icon-quote-left"></i>
        谢谢打赏
        <i class="icon icon-quote-right"></i>
    </h3>
    <div class="reward-content">
        
        <div class="reward-code">
            <img id="rewardCode" src="/img/wechat.jpg" alt="打赏二维码">
        </div>
        
        <label class="reward-toggle">
            <input id="rewardToggle" type="checkbox" class="reward-toggle-check"
                data-wechat="/img/wechat.jpg" data-alipay="/img/alipay.jpg">
            <div class="reward-toggle-ctrol">
                <span class="reward-toggle-item wechat">微信</span>
                <span class="reward-toggle-label"></span>
                <span class="reward-toggle-item alipay">支付宝</span>
            </div>
        </label>
        
    </div>
</div>



</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            
                <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>Greedyhao &copy; 2017 - 2018</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://greedyhao.cc/2018/07/05/工作-stm32-2018-07-05-使用Cubemx移植FatFs到stm32/&title=《使用Cubemx移植FatFs到stm32》 — Zhuhao's Blog&pic=http://greedyhao.cc/img/portrait.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://greedyhao.cc/2018/07/05/工作-stm32-2018-07-05-使用Cubemx移植FatFs到stm32/&title=《使用Cubemx移植FatFs到stm32》 — Zhuhao's Blog&source=linux,c,python,stm32" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://greedyhao.cc/2018/07/05/工作-stm32-2018-07-05-使用Cubemx移植FatFs到stm32/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《使用Cubemx移植FatFs到stm32》 — Zhuhao's Blog&url=http://greedyhao.cc/2018/07/05/工作-stm32-2018-07-05-使用Cubemx移植FatFs到stm32/&via=http://greedyhao.cc" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://greedyhao.cc/2018/07/05/工作-stm32-2018-07-05-使用Cubemx移植FatFs到stm32/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: true };


</script>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/search.min.js" async></script>



<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
    tex2jax: {
        inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
        processEscapes: true,
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
    }
});

MathJax.Hub.Queue(function() {
    var all = MathJax.Hub.getAllJax(), i;
    for(i=0; i < all.length; i += 1) {
        all[i].SourceElement().parentNode.className += ' has-jax';
    }
});
</script>

<script async src="//cdn.bootcss.com/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML" async></script>




<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>



<script>
(function() {
    var OriginTitile = document.title, titleTime;
    document.addEventListener('visibilitychange', function() {
        if (document.hidden) {
            document.title = '再见';
            clearTimeout(titleTime);
        } else {
            document.title = '你好';
            titleTime = setTimeout(function() {
                document.title = OriginTitile;
            },2000);
        }
    });
})();
</script>



</body>
</html>
